<section ng-controller="ProductController">
	<h1 class="page-header">Quản lý sản phẩm</h1>
	
	<div class="col-xs-12 col-md-12 mg-b2">
		<button type="button" class="btn btn-primary pull-right" ng-click="openCreatePopup()"><span class="glyphicon glyphicon-plus"></span> Thêm</button>
	</div>
	<div class="col-xs-12 col-md-12">
		<table class="table" ng-init="getProductList()">
			<tr class="f-bold">
				<td>Hình ảnh</td>
				<td>Tên</td>
				<td>Danh mục</td>				
				<td>Giá</td>				
				<td>Sửa</td>				
				<td>Xóa</td>				
			</tr>
			<tr ng-repeat="item in productList">
				<td><img ng-src="../upload/{{item.image1}}" class="productImg" ng-show="item.image1"/>
					<img ng-src="../upload/{{item.image2}}" class="productImg" ng-show="item.image2"/>
					<img ng-src="../upload/{{item.image3}}" class="productImg" ng-show="item.image3"/>
				</td>
				<td>{{item.name}}</td>
				<td>{{item.sub_name || item.cat_name}}</td>
				<td>{{item.price | number:0}} VND</td>
				<td><a href="javascript:void(0)" ng-click="editProduct($index,item.id)"><span class="glyphicon glyphicon-edit"></span></a></td>
				<td><a href="javascript:void(0)" ng-click="deleteProduct(item.id)"><span class="glyphicon glyphicon-trash"></span></a></td>
			</tr>
			
		</table>
		<pagination 
			class="pagination-sm pull-right" 
			total-items="total" 
			previous-text ="&laquo;"
			next-text ="&raquo;"
			max-size="5"
			first-text="Đầu"
			last-text="Cuối"
			items-per-page= "limit" 
			align="true"
			ng-model="curPage" 
			ng-change="getProductList()"
			boundary-links="false">
		</pagination>
	</div>
	
</section>